//
//  FunctionViewController.m
//  dangdang
//
//  Created by air on 16/3/15.
//  Copyright © 2016年 luweijie. All rights reserved.
//

#import "FunctionViewController.h"

@interface FunctionViewController ()<UIScrollViewDelegate>

@property (nonatomic, strong) UIScrollView * myScrollView;

@end

@implementation FunctionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self updateUI];
    
    self.title = @"功能介绍";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)updateUI
{    
    _myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
    [_myScrollView setPagingEnabled:YES];
    [_myScrollView setDelegate:self];
    _myScrollView.showsVerticalScrollIndicator = NO;
    _myScrollView.showsHorizontalScrollIndicator = NO;
    
    for (int i = 0; i < arr.count; i ++) {
        UIImageView *img=[[UIImageView alloc] initWithFrame:CGRectMake(i * self.view.bounds.size.width, -64, self.view.bounds.size.width, self.view.bounds.size.height)];
        img.backgroundColor = [UIColor clearColor];
        img.userInteractionEnabled = YES;
        img.image=[UIImage imageNamed:arr[i]];
        
        [_myScrollView addSubview:img];
    }
    
    _myScrollView.contentSize = CGSizeMake([UIScreen mainScreen].bounds.size.width * arr.count, 0);
    [_myScrollView scrollRectToVisible:CGRectMake([UIScreen mainScreen].bounds.size.width, 0, [UIScreen mainScreen].bounds.size.width, _myScrollView.frame.size.height) animated:NO];
    _myScrollView.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:_myScrollView];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
